![]() |
KeyScript |
||||
Header: | Events.h | Carbon status: | Supported | |
Changes the keyboard script (the script system used for keyboard input), changes the keyboard layout (the mapping of keys to characters) or input method within the current keyboard script (a facility for entering 2-byte characters), or makes a setting related to text input, using the supplied value.
void KeyScript ( SInt16 code );
If 0 or positive, directly specifies a script system (that is, it is read as a script code). Negative values have special meanings.
The code parameter is a selector that can explicitly specify a keyboard script by script code. Script code constants are listed in
The selector can also implicitly specify a keyboard script (for example, the next script), a keyboard layout (for example, the previously used keyboard layout in the current script), or an input method (for example, inline input versus window-based input). It can also specify settings that enable or disable keyboard layouts and keyboard scripts, and toggle among input options or line direction.
For the purposes of KeyScript, keyboard layout means a keyboard-layout ('KCHR') resource, plus optionally a key-remap ('itlk') resource. To change keyboard layouts means to change the current keyboard-layout resource.
If the Keyboard menu is displayed, KeyScript also updates the Keyboard menu.
If you call KeyScript and explicitly specify a script system that is not available, KeyScript does nothing. The current keyboard script remains unchanged.
KeyScript operates only on those keyboard-layout and key-remap resources that are present in the System file.
Your application’s keyboard-menu setting is not maintained by the Process Manager; if the state of the keyboard menu is changed while you are switched out, the Process Manager does not restore your setting when you are switched back in. However, the Process Manager does maintain the keyboard disable state (Script Manager variable smKeyDisableState) for your application. See
KeyScript may move memory; your application should not call this function at interrupt time.
Supported in Carbon. Available in Carbon 1.0.2 and later when running Mac OS 8.1 or later.
© 2000 Apple Computer, Inc. (Last Updated 6/30/2000)